<template>
  <div class="inventory-container">
    <v-btn variant="outlined" @click="isPage = !isPage"> 切换 </v-btn>
    <lattice-slot :list="list" v-if="isPage"></lattice-slot>
    <prop-editing v-else />
  </div>
</template>
<script lang="ts" setup>
import LatticeSlot from "./LatticeSlot.vue";

import PropEditing from "./PropEditing.vue";

import { getPlayerWareHouse } from "@/api/player";

import type { SlotItem } from "@/types/player";
const testUrl = "http://cdn2.xintianyuehui.cn/2022PicGo202207181118973.png";

const isPage = ref(false);

//val 和 count 不可能同时存在
const list = reactive<SlotItem[]>([]);

const getWareHouseData = () => {
  getPlayerWareHouse(1)
    .then((res) => {
      const { response = [{ WareHouse: {}, Items: [] }] } = res;
      list.length = 0;
      list.push(...response[0]['Items'])
    })
    .catch((err) => {
      console.error(err);
    })
    .finally(() => {});
};

getWareHouseData();
</script>

<style lang="scss" scoped>
.inventory-container {
  padding: 10px;
}
</style>
